﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SmartMD.DataModel.Entity;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace SmartMD.Manager.Specimens
{
    /// <summary>
    /// Interaction logic for ListPad.xaml
    /// </summary>
    public partial class SpecListPad : BasePad
    {
        private static SpecListPad  _instance;
        public SpecListPad()
        {
            InitializeComponent();

            specInfoList = new ObservableCollection<SpecInfo>();
            ICollectionView view = CollectionViewSource.GetDefaultView(specInfoList);
            this.SpecList.ItemsSource = view;
        }

        public static SpecListPad Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new SpecListPad();
                    MainWindow.AddLeftPad(_instance);
                }
                return _instance;
            }
        }
        public StoreSpecPanel Owner { get; set; }

        private ObservableCollection<SpecInfo> _specInfoList;
        public ObservableCollection<SpecInfo> specInfoList
        {
            get
            {
                return _specInfoList;
            }
            set
            {
                _specInfoList = value;
            }
        }

        public void AddItem(SpecInfo item)
        {
            specInfoList.Add(item);
        }
        private void BtnSearch_Click(object sender, RoutedEventArgs e)
        {

        }

        private void SpecList_PreviewMouseMove(object sender, MouseEventArgs e)
        {

        }

        private void SpecList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (this.SpecList.SelectedItem == null)
                return;
            this.Owner.ucSpecStoreEdit.DataSource = (SpecInfo)this.SpecList.SelectedItem;
        }

        private void TxtSearch_KeyDown(object sender, KeyEventArgs e)
        {

        }


    }
}
